// 统一管理首页模块接口
import request from "@/utils/request";
import type { HospitalResponseData, HospitalLevelAndRegionResponseData, HospitalInfo } from "./type";

// 通过枚举管理首页模块的接口地址
enum API {
  // 获取已有的医院的数据接口地址
  HOSPITAL_URL = '/hosp/hospital/',
  // 获取医院的等级与地区
  HOSPITALLEVELANDREGION_URL = '/cmn/dict/findByDictCode/',
  // 根据医院名获取资源
  HOSPITALINFO_URL = '/hosp/hospital/findByHosname/'
}

export const reqHospital = (page: number, limit: number, hostype='', districtCode='') => request.get<any, HospitalResponseData>(
  API.HOSPITAL_URL + `${page}/${limit}?hostype=${hostype}&districtCode=${districtCode}`
)

export const reqHospitalLevelAndRegion = (dictCode: string) => request.get<any, HospitalLevelAndRegionResponseData>(
  API.HOSPITALLEVELANDREGION_URL + `${dictCode}`
)

export const reqHospitalInfo = (hostname: string) => request.get<any, HospitalInfo>(
  API.HOSPITALINFO_URL + hostname
)